import "package:flutter/material.dart";

class MaterialTheme {
  final TextTheme textTheme;

  const MaterialTheme(this.textTheme);

  static ColorScheme lightScheme() {
    return const ColorScheme(
      brightness: Brightness.light,
      primary: Color(0xff0e45bb),
      surfaceTint: Color(0xff2855ca),
      onPrimary: Color(0xffffffff),
      primaryContainer: Color(0xff446de2),
      onPrimaryContainer: Color(0xffffffff),
      secondary: Color(0xff4f5c8a),
      onSecondary: Color(0xffffffff),
      secondaryContainer: Color(0xffc6d1ff),
      onSecondaryContainer: Color(0xff2f3c67),
      tertiary: Color(0xff81268f),
      onTertiary: Color(0xffffffff),
      tertiaryContainer: Color(0xffab4fb7),
      onTertiaryContainer: Color(0xffffffff),
      error: Color(0xffba1a1a),
      onError: Color(0xffffffff),
      errorContainer: Color(0xffffdad6),
      onErrorContainer: Color(0xff410002),
      surface: Color(0xfffaf8ff),
      onSurface: Color(0xff1a1b22),
      onSurfaceVariant: Color(0xff434654),
      outline: Color(0xff747685),
      outlineVariant: Color(0xffc4c5d6),
      shadow: Color(0xff000000),
      scrim: Color(0xff000000),
      inverseSurface: Color(0xff2f3038),
      inversePrimary: Color(0xffb5c4ff),
      primaryFixed: Color(0xffdce1ff),
      onPrimaryFixed: Color(0xff00164d),
      primaryFixedDim: Color(0xffb5c4ff),
      onPrimaryFixedVariant: Color(0xff003cac),
      secondaryFixed: Color(0xffdce1ff),
      onSecondaryFixed: Color(0xff091843),
      secondaryFixedDim: Color(0xffb7c5f8),
      onSecondaryFixedVariant: Color(0xff384571),
      tertiaryFixed: Color(0xffffd6fd),
      onTertiaryFixed: Color(0xff35003f),
      tertiaryFixedDim: Color(0xfffaabff),
      onTertiaryFixedVariant: Color(0xff761a85),
      surfaceDim: Color(0xffd9d9e3),
      surfaceBright: Color(0xfffaf8ff),
      surfaceContainerLowest: Color(0xffffffff),
      surfaceContainerLow: Color(0xfff3f3fd),
      surfaceContainer: Color(0xffededf7),
      surfaceContainerHigh: Color(0xffe8e7f2),
      surfaceContainerHighest: Color(0xffe2e1ec),
    );
  }

  ThemeData light() {
    return theme(lightScheme());
  }

  static ColorScheme lightMediumContrastScheme() {
    return const ColorScheme(
      brightness: Brightness.light,
      primary: Color(0xff0039a4),
      surfaceTint: Color(0xff2855ca),
      onPrimary: Color(0xffffffff),
      primaryContainer: Color(0xff446de2),
      onPrimaryContainer: Color(0xffffffff),
      secondary: Color(0xff34416c),
      onSecondary: Color(0xffffffff),
      secondaryContainer: Color(0xff6673a2),
      onSecondaryContainer: Color(0xffffffff),
      tertiary: Color(0xff711480),
      onTertiary: Color(0xffffffff),
      tertiaryContainer: Color(0xffab4fb7),
      onTertiaryContainer: Color(0xffffffff),
      error: Color(0xff8c0009),
      onError: Color(0xffffffff),
      errorContainer: Color(0xffda342e),
      onErrorContainer: Color(0xffffffff),
      surface: Color(0xfffaf8ff),
      onSurface: Color(0xff1a1b22),
      onSurfaceVariant: Color(0xff3f424f),
      outline: Color(0xff5c5e6c),
      outlineVariant: Color(0xff777a89),
      shadow: Color(0xff000000),
      scrim: Color(0xff000000),
      inverseSurface: Color(0xff2f3038),
      inversePrimary: Color(0xffb5c4ff),
      primaryFixed: Color(0xff446de2),
      onPrimaryFixed: Color(0xffffffff),
      primaryFixedDim: Color(0xff2453c8),
      onPrimaryFixedVariant: Color(0xffffffff),
      secondaryFixed: Color(0xff6673a2),
      onSecondaryFixed: Color(0xffffffff),
      secondaryFixedDim: Color(0xff4d5a87),
      onSecondaryFixedVariant: Color(0xffffffff),
      tertiaryFixed: Color(0xffab4fb7),
      onTertiaryFixed: Color(0xffffffff),
      tertiaryFixedDim: Color(0xff8e349c),
      onTertiaryFixedVariant: Color(0xffffffff),
      surfaceDim: Color(0xffd9d9e3),
      surfaceBright: Color(0xfffaf8ff),
      surfaceContainerLowest: Color(0xffffffff),
      surfaceContainerLow: Color(0xfff3f3fd),
      surfaceContainer: Color(0xffededf7),
      surfaceContainerHigh: Color(0xffe8e7f2),
      surfaceContainerHighest: Color(0xffe2e1ec),
    );
  }

  ThemeData lightMediumContrast() {
    return theme(lightMediumContrastScheme());
  }

  static ColorScheme lightHighContrastScheme() {
    return const ColorScheme(
      brightness: Brightness.light,
      primary: Color(0xff001c5c),
      surfaceTint: Color(0xff2855ca),
      onPrimary: Color(0xffffffff),
      primaryContainer: Color(0xff0039a4),
      onPrimaryContainer: Color(0xffffffff),
      secondary: Color(0xff111f4a),
      onSecondary: Color(0xffffffff),
      secondaryContainer: Color(0xff34416c),
      onSecondaryContainer: Color(0xffffffff),
      tertiary: Color(0xff40004b),
      onTertiary: Color(0xffffffff),
      tertiaryContainer: Color(0xff711480),
      onTertiaryContainer: Color(0xffffffff),
      error: Color(0xff4e0002),
      onError: Color(0xffffffff),
      errorContainer: Color(0xff8c0009),
      onErrorContainer: Color(0xffffffff),
      surface: Color(0xfffaf8ff),
      onSurface: Color(0xff000000),
      onSurfaceVariant: Color(0xff202330),
      outline: Color(0xff3f424f),
      outlineVariant: Color(0xff3f424f),
      shadow: Color(0xff000000),
      scrim: Color(0xff000000),
      inverseSurface: Color(0xff2f3038),
      inversePrimary: Color(0xffe8ebff),
      primaryFixed: Color(0xff0039a4),
      onPrimaryFixed: Color(0xffffffff),
      primaryFixedDim: Color(0xff002573),
      onPrimaryFixedVariant: Color(0xffffffff),
      secondaryFixed: Color(0xff34416c),
      onSecondaryFixed: Color(0xffffffff),
      secondaryFixedDim: Color(0xff1c2a55),
      onSecondaryFixedVariant: Color(0xffffffff),
      tertiaryFixed: Color(0xff711480),
      onTertiaryFixed: Color(0xffffffff),
      tertiaryFixedDim: Color(0xff51005f),
      onTertiaryFixedVariant: Color(0xffffffff),
      surfaceDim: Color(0xffd9d9e3),
      surfaceBright: Color(0xfffaf8ff),
      surfaceContainerLowest: Color(0xffffffff),
      surfaceContainerLow: Color(0xfff3f3fd),
      surfaceContainer: Color(0xffededf7),
      surfaceContainerHigh: Color(0xffe8e7f2),
      surfaceContainerHighest: Color(0xffe2e1ec),
    );
  }

  ThemeData lightHighContrast() {
    return theme(lightHighContrastScheme());
  }

  static ColorScheme darkScheme() {
    return const ColorScheme(
      brightness: Brightness.dark,
      primary: Color(0xffb5c4ff),
      surfaceTint: Color(0xffb5c4ff),
      onPrimary: Color(0xff00297b),
      primaryContainer: Color(0xff446de2),
      onPrimaryContainer: Color(0xffffffff),
      secondary: Color(0xffb7c5f8),
      onSecondary: Color(0xff202e59),
      secondaryContainer: Color(0xff2e3c67),
      onSecondaryContainer: Color(0xffc4d0ff),
      tertiary: Color(0xfffaabff),
      onTertiary: Color(0xff570065),
      tertiaryContainer: Color(0xffac50b8),
      onTertiaryContainer: Color(0xffffffff),
      error: Color(0xffffb4ab),
      onError: Color(0xff690005),
      errorContainer: Color(0xff93000a),
      onErrorContainer: Color(0xffffdad6),
      surface: Color(0xff11131a),
      onSurface: Color(0xffe2e1ec),
      onSurfaceVariant: Color(0xffc4c5d6),
      outline: Color(0xff8e909f),
      outlineVariant: Color(0xff434654),
      shadow: Color(0xff000000),
      scrim: Color(0xff000000),
      inverseSurface: Color(0xffe2e1ec),
      inversePrimary: Color(0xff2855ca),
      primaryFixed: Color(0xffdce1ff),
      onPrimaryFixed: Color(0xff00164d),
      primaryFixedDim: Color(0xffb5c4ff),
      onPrimaryFixedVariant: Color(0xff003cac),
      secondaryFixed: Color(0xffdce1ff),
      onSecondaryFixed: Color(0xff091843),
      secondaryFixedDim: Color(0xffb7c5f8),
      onSecondaryFixedVariant: Color(0xff384571),
      tertiaryFixed: Color(0xffffd6fd),
      onTertiaryFixed: Color(0xff35003f),
      tertiaryFixedDim: Color(0xfffaabff),
      onTertiaryFixedVariant: Color(0xff761a85),
      surfaceDim: Color(0xff11131a),
      surfaceBright: Color(0xff373941),
      surfaceContainerLowest: Color(0xff0c0e15),
      surfaceContainerLow: Color(0xff1a1b22),
      surfaceContainer: Color(0xff1e1f27),
      surfaceContainerHigh: Color(0xff282a31),
      surfaceContainerHighest: Color(0xff33343c),
    );
  }

  ThemeData dark() {
    return theme(darkScheme());
  }

  static ColorScheme darkMediumContrastScheme() {
    return const ColorScheme(
      brightness: Brightness.dark,
      primary: Color(0xffbbc9ff),
      surfaceTint: Color(0xffb5c4ff),
      onPrimary: Color(0xff001242),
      primaryContainer: Color(0xff648aff),
      onPrimaryContainer: Color(0xff000000),
      secondary: Color(0xffbcc9fd),
      onSecondary: Color(0xff03133d),
      secondaryContainer: Color(0xff828fc0),
      onSecondaryContainer: Color(0xff000000),
      tertiary: Color(0xfffbb2ff),
      onTertiary: Color(0xff2d0035),
      tertiaryContainer: Color(0xffcb6cd6),
      onTertiaryContainer: Color(0xff000000),
      error: Color(0xffffbab1),
      onError: Color(0xff370001),
      errorContainer: Color(0xffff5449),
      onErrorContainer: Color(0xff000000),
      surface: Color(0xff11131a),
      onSurface: Color(0xfffcfaff),
      onSurfaceVariant: Color(0xffc8cada),
      outline: Color(0xffa0a2b2),
      outlineVariant: Color(0xff808291),
      shadow: Color(0xff000000),
      scrim: Color(0xff000000),
      inverseSurface: Color(0xffe2e1ec),
      inversePrimary: Color(0xff003daf),
      primaryFixed: Color(0xffdce1ff),
      onPrimaryFixed: Color(0xff000d36),
      primaryFixedDim: Color(0xffb5c4ff),
      onPrimaryFixedVariant: Color(0xff002e88),
      secondaryFixed: Color(0xffdce1ff),
      onSecondaryFixed: Color(0xff000d36),
      secondaryFixedDim: Color(0xffb7c5f8),
      onSecondaryFixedVariant: Color(0xff26345f),
      tertiaryFixed: Color(0xffffd6fd),
      onTertiaryFixed: Color(0xff25002c),
      tertiaryFixedDim: Color(0xfffaabff),
      onTertiaryFixedVariant: Color(0xff610070),
      surfaceDim: Color(0xff11131a),
      surfaceBright: Color(0xff373941),
      surfaceContainerLowest: Color(0xff0c0e15),
      surfaceContainerLow: Color(0xff1a1b22),
      surfaceContainer: Color(0xff1e1f27),
      surfaceContainerHigh: Color(0xff282a31),
      surfaceContainerHighest: Color(0xff33343c),
    );
  }

  ThemeData darkMediumContrast() {
    return theme(darkMediumContrastScheme());
  }

  static ColorScheme darkHighContrastScheme() {
    return const ColorScheme(
      brightness: Brightness.dark,
      primary: Color(0xfffcfaff),
      surfaceTint: Color(0xffb5c4ff),
      onPrimary: Color(0xff000000),
      primaryContainer: Color(0xffbbc9ff),
      onPrimaryContainer: Color(0xff000000),
      secondary: Color(0xfffcfaff),
      onSecondary: Color(0xff000000),
      secondaryContainer: Color(0xffbcc9fd),
      onSecondaryContainer: Color(0xff000000),
      tertiary: Color(0xfffff9fa),
      onTertiary: Color(0xff000000),
      tertiaryContainer: Color(0xfffbb2ff),
      onTertiaryContainer: Color(0xff000000),
      error: Color(0xfffff9f9),
      onError: Color(0xff000000),
      errorContainer: Color(0xffffbab1),
      onErrorContainer: Color(0xff000000),
      surface: Color(0xff11131a),
      onSurface: Color(0xffffffff),
      onSurfaceVariant: Color(0xfffcfaff),
      outline: Color(0xffc8cada),
      outlineVariant: Color(0xffc8cada),
      shadow: Color(0xff000000),
      scrim: Color(0xff000000),
      inverseSurface: Color(0xffe2e1ec),
      inversePrimary: Color(0xff00236d),
      primaryFixed: Color(0xffe1e6ff),
      onPrimaryFixed: Color(0xff000000),
      primaryFixedDim: Color(0xffbbc9ff),
      onPrimaryFixedVariant: Color(0xff001242),
      secondaryFixed: Color(0xffe1e6ff),
      onSecondaryFixed: Color(0xff000000),
      secondaryFixedDim: Color(0xffbcc9fd),
      onSecondaryFixedVariant: Color(0xff03133d),
      tertiaryFixed: Color(0xffffdcfd),
      onTertiaryFixed: Color(0xff000000),
      tertiaryFixedDim: Color(0xfffbb2ff),
      onTertiaryFixedVariant: Color(0xff2d0035),
      surfaceDim: Color(0xff11131a),
      surfaceBright: Color(0xff373941),
      surfaceContainerLowest: Color(0xff0c0e15),
      surfaceContainerLow: Color(0xff1a1b22),
      surfaceContainer: Color(0xff1e1f27),
      surfaceContainerHigh: Color(0xff282a31),
      surfaceContainerHighest: Color(0xff33343c),
    );
  }

  ThemeData darkHighContrast() {
    return theme(darkHighContrastScheme());
  }

  ThemeData theme(ColorScheme colorScheme) => ThemeData(
        useMaterial3: true,
        brightness: colorScheme.brightness,
        colorScheme: colorScheme,
        textTheme: textTheme.apply(
          bodyColor: colorScheme.onSurface,
          displayColor: colorScheme.onSurface,
        ),
        scaffoldBackgroundColor: colorScheme.surface,
        canvasColor: colorScheme.surface,
      );

  List<ExtendedColor> get extendedColors => [];
}

class ExtendedColor {
  final Color seed, value;
  final ColorFamily light;
  final ColorFamily lightHighContrast;
  final ColorFamily lightMediumContrast;
  final ColorFamily dark;
  final ColorFamily darkHighContrast;
  final ColorFamily darkMediumContrast;

  const ExtendedColor({
    required this.seed,
    required this.value,
    required this.light,
    required this.lightHighContrast,
    required this.lightMediumContrast,
    required this.dark,
    required this.darkHighContrast,
    required this.darkMediumContrast,
  });
}

class ColorFamily {
  const ColorFamily({
    required this.color,
    required this.onColor,
    required this.colorContainer,
    required this.onColorContainer,
  });

  final Color color;
  final Color onColor;
  final Color colorContainer;
  final Color onColorContainer;
}
